
program Polygons;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  a, b, c, d, i, j, n: integer;
  x, y: array of integer;
  flag1, flag2, flag: boolean;
begin
  flag:= true;
  Writeln ('enter the number of polygon"s peaks');
  readln (n);
  Writeln ('enter their coordinates');
  setlength (x, n+1);
  setlength (y, n+1);
  for i:= 0 to n-1 do
    readln (x[i], y[i]);
  x[n]:=x[0];
  y[n]:=y[0];
  for i:= 0 to n-2 do
  begin
    flag1:=true;
    flag2:=false;
    a:= y[i]-y[i+1];
    b:= x[i+1]-x[i];
    c:= y[i+1]*x[i]+y[i]*y[i+1];
    for j:= i+2 to n do
    begin
      d:=round((a*x[j]+b*y[j]+c)/(sqrt(a*a+b*b)));
      if (d>0) then begin
      flag2:=true;
      end else
      begin
      flag1:= false;
      end;
    end;
    if (flag1 = false) and (flag2 = true) then flag:= false;
  end;
  if (flag) then writeln ('your polygon is conved') else
                 writeln ('your polygon isn"t convex');
  readln;

end.
